package com.google.code.yanf4j.test;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;

import com.google.code.yanf4j.core.Session;
import com.google.code.yanf4j.core.impl.HandlerAdapter;

public class TimeHandler extends HandlerAdapter {

	@Override
	public void onSessionStarted(Session session) {
		Date date = new Date();
		DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		session.write(dateFormat.format(date));
		//session.asyncWrite(dateFormat.format(date));

		session.flush();
		session.close();

	}
}
